import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { StockInfoVO, StockInfoForm, StockInfoQuery } from '@/api/stock/stockInfo/types';

/**
 * 查询股票详情列表
 * @param query
 * @returns {*}
 */

export const listStockInfo = (query?: StockInfoQuery): AxiosPromise<StockInfoVO[]> => {
  return request({
    url: '/stock/stockInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询股票详情详细
 * @param code
 */
export const getStockInfo = (code: string | number): AxiosPromise<StockInfoVO> => {
  return request({
    url: '/stock/stockInfo/' + code,
    method: 'get'
  });
};

/**
 * 新增股票详情
 * @param data
 */
export const addStockInfo = (data: StockInfoForm) => {
  return request({
    url: '/stock/stockInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改股票详情
 * @param data
 */
export const updateStockInfo = (data: StockInfoForm) => {
  return request({
    url: '/stock/stockInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除股票详情
 * @param code
 */
export const delStockInfo = (code: string | number | Array<string | number>) => {
  return request({
    url: '/stock/stockInfo/' + code,
    method: 'delete'
  });
};
